package com.hmdp.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 *
 *
 *  Redisson 配置
 *
 */
@Configuration
public class RedissonConfig {


    /**
     *
     *
     *  RedissonClient  创建连接对象
     *
     *
     * @return
     */
    @Bean
    public RedissonClient redissonClient(){
        // 配置
        Config config = new Config();

        config.useSingleServer().setAddress("redis://127.0.0.1:6379");

        // 设置密码
        config.useSingleServer()
                .setPassword("123456")
                .setTimeout(3000)
                .setPingConnectionInterval(60000)
                .setConnectionPoolSize(64)
                .setConnectionMinimumIdleSize(10);

        // 创建 RedissonClient 对象
        return Redisson.create(config);
    }


}
